<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="<?=base_url()?>public/css/style1.css" />
<script type="text/javascript" src="<?=base_url()?>public/js/jq.1.12.4.js"></script>
<title>注册</title>
<style>
    .content_box>.one{
        position:relative;
		height:35px;
    }
    .content_box>.one>b{
        position: absolute;
        width: 200px;
        top: 8px;
        right: -200px;
        display:none;
    }
	.content_box>.one>span{
		height:35px;
		line-height:35px;
	}
	.content_box>.one>input:first-child{
		width:100%;
		max-width:calc(100% - 117px);
		float:right;
	}
	//.content_box #up_account{
	//	transform:translateX(-5px);
		//width:100%;
		//max-width:calc(100% - 117px);
		//float:right;
	//}
	#btn_sendcode{
		margin-left:0px !important;
		padding:0px !important;
	}
	@media screen and (max-width:1360px){
		.content_box>.one{
			height:56px;
		}	
		.content_box #up_account{
			width:100%;
			max-width:100%;
			float:none;
		}
		.content_box .one input{
			width:100% !important;
			max-width:100% !important;
			float:none !important;
		}
		.content_box input#btn_sendcode{
			width:77px !important;
			height:34px !important;
			float:right !important;
		}
		#mobile{
			width:calc(100% - 84px) !important;
			float:left !important;
			//margin-left:0px !important;
		}
		.content_box .one:after{
			content:"";
			display:table;
			clear:both;
		}
		#check_code{
			margin-left:5px !important;
		}
		.content_box p span{
			text-align:left;
			text-indent:20px;
		}
	}

</style>
</head>
<body>
<div class="bg1">
   <div class="logo1">
   	<div class="logo1_box">
   		<img src="<?=base_url()?>public/img/logo.png" /><span>公益扶农合作平台</span>
    </div>
   </div>
   <div class="content">
   <div style="border-bottom:1px dotted #bac49d; background-image:url(<?=base_url()?>public/img/icon35.png); background-repeat:no-repeat; background-position:20px 0px;">
   	  <?php echo form_open('reg/info_post',array('id'=>'myform')); ?>
        <div class="content_box">
   		<p class="one"><span>公益账号</span><input name="user_account" id="user_account"  type="text" placeholder="" /><b></b></p>
        <p class="one"><span style="margin-right:6px">公益推广人</span>
        <?php if(!empty($up_account_flag == '1')): ?>
        <input type="text" name="up_account" id="up_account" value="<?php echo $up_account; ?>" readonly="readonly"/>
        </p>
        <?php else: ?>
        <input name="up_account" id="up_account" type="text" placeholder="" value="" /><b></b></p>
		<!--<?php echo $up_account; ?>上面的默认-->
        <?php endif;  ?>
        <p class="one"><span>登录密码</span><input name="pwd" id="pwd" type="password" placeholder="" /><b></b></p>
        <p class="one"><span>确认密码</span><input id="again_pwd" type="password" placeholder="" /><b></b></p>
        <p class="one"><span>二级密码</span><input name="spwd" id="spwd" type="password" placeholder="" /><b></b></p>
        <p class="one"><span>二级密码确认</span><input name="again_spwd" id="again_spwd" type="password" placeholder="" /><b></b></p>
        <p class="one"><span>姓名</span><input name="user_name" id="user_name" type="text" placeholder="" /><b></b></p>
        <p style="position:relative;" class="one"><span>手机号</span><input name="mobile" id="mobile" type="text" style='width:50%;' />
            <input id="btn_sendcode" style=" width:18%; box-shadow:none;color:#254e01;border:1px solid #d1d6df;background:#f5fed9;margin-left:5px;box-shadow:-3px 3px 4px 1px rgba(11,2,5,0.3);color:#7e7e7e;" type="button" value="发送验证码" />
			<b class='phoooo'></b>
		</p>
        <p  class="one">
          <span>验证码</span>
          <input style="margin-left: -1px;" id="check_code"  name="check_code" type="text" placeholder="" /><b style='display:block;'></b>

          <!-- <input id="sms_code"  type="hidden" value=""/> -->
        </p>
        <p class="one"><span>支付宝账号</span><input id="zfb_account" name="zfb_account" type="text" placeholder="" /><b></b></p>
        </div>
        </div>
        <div style="background-image:url(<?=base_url()?>public/img/icon36.png); background-repeat:no-repeat; background-position:20px 0px;">
        <div class="content_box">
        <p class="one"><span>开户行</span><input type="text" name="bank_name" placeholder="" /><b></b></p>
        <p class="one"><span>银行卡号</span><input type="text" name="bank_card" placeholder="" /><b></b></p>
        <p class="one"><span>微信号</span><input type="text" name="wx_id" placeholder="" /><b></b></p>
        <p class="btn" id="btn_submit"><input style="position:relative;width:45%; background:#254e01; color:white; margin-top:40px; margin-left:35%;height:40px;border:none" type="submit" value="确认注册"></p>
		<p class="btn"><a href='login' style="position:relative;width:45%; background:#254e01; color:white; margin-left:32%; margin-top:15px; margin-left:35%;height:40px;border:none;display:block;font-size:12px;text-align:center;line-height:40px;" id='delu'>返回登录</a></p>
   	    </div>
      </form>
    </div>
   </div>
</div>
<div style='position:fixed;width:18%;height:220px;background:rgba(133,220,75,0.7);color:white;top:40%;left:43%;text-align:center;line-height:220px;display:none;' class='tishi' >dwadwadaw</div>
</body>
</html>
<script type="text/javascript">
$(function(){
	$('#btn_submit').on('mousedown',function(){
		$('#btn_submit>input').css('top','5px');
		//console.log(1)
	})
	$('#btn_submit').on('mouseup',function(){
		$('#btn_submit>input').css('top','0');
		//console.log(2)
	})
	$('#delu').on('mousedown',function(){
		$('#delu').css('top','5px');
		//console.log(1)
	})
	$('#delu').on('mouseup',function(){
		$('#delu').css('top','0');
		//console.log(2)
	})
	//$('.tishi').on('click',function(){
		//$('.tishi').css('display','none');
//	})
	var namer = /[\u4e00-\u9fa5]/;
	var phon = /^1[3458]\d{9}$/;
  $('#btn_submit').on('click', function(event) {
    
    //账号
    if($('#user_account').val() == ''){
      //alert('请输入公益账号');
	   $('#user_account').siblings("b").css('display','block');
	   $('#user_account').siblings("b").text('请输入公益账号');
      return false;
    }else{
		 $('#user_account').siblings("b").css('display','none');
	}
    if($('#user_account').val().length < 6){
		 $('#user_account').siblings("b").css('display','block');
	    $('#user_account').siblings("b").text('公益账号长度不得少于6位');
        //alert('公益账号长度不得少于6位');
        return false;
	}else{
		 $('#user_account').siblings("b").css('display','none');
	}
    if($('#user_account').val().length > 20){
		$('#user_account').siblings("b").css('display','block');
	    $('#user_account').siblings("b").text('公益账号长度不得大于20位');
        //alert('公益账号长度不得大于20位');
        return false;
	}else{
		 $('#user_account').siblings("b").css('display','none');
	}
    
    //公益推广人
    if($('#up_account').val() == 0){
		$('#up_account').siblings("b").css('display','block');
	    $('#up_account').siblings("b").text('请输入公益推广人');
     // alert('请输入公益推广人');
      return false;
    }else{
		 $('#up_account').siblings("b").css('display','none');
	}
    
    //密码
    if($('#pwd').val() == ''){
		$('#pwd').siblings("b").css('display','block');
	    $('#pwd').siblings("b").text('请输入密码');
     // alert('请输入密码');
      return false;
    }else{
		 $('#pwd').siblings("b").css('display','none');
	}
    if($('#pwd').val().length < 6){
		$('#pwd').siblings("b").css('display','block');
	    $('#pwd').siblings("b").text('密码长度不得少于6位');
       // alert('密码长度不得少于6位');
        return false;
	}else{
		 $('#pwd').siblings("b").css('display','none');
	}
    if($('#pwd').val().length > 20){
		$('#pwd').siblings("b").css('display','block');
	    $('#pwd').siblings("b").text('密码长度不得大于20位');
      //  alert('密码长度不得大于20位');
        return false;
	}else{
		 $('#pwd').siblings("b").css('display','none');
	}
    
    //校验
    if($('#pwd').val() != $('#again_pwd').val()){
	$('#again_pwd').siblings("b").css('display','block');
	$('#again_pwd').siblings("b").text('两次输入的密码不一样');
     // alert('两次输入的密码不一样');
      return false;
    }else{
		 $('#again_pwd').siblings("b").css('display','none');
	}
    
    //二级密码
    if($('#spwd').val() == ''){
		$('#spwd').siblings("b").css('display','block');
		$('#spwd').siblings("b").text('请输入二级密码');
     // alert('请输入二级密码');
      return false;
    }else{
		 $('#spwd').siblings("b").css('display','none');
	}
	 //校验二级密码和密码
    if($('#spwd').val() == $('#pwd').val()){
		$('#spwd').siblings("b").css('display','block');
		$('#spwd').siblings("b").text('输入的二级密码不能和密码一样');
     // alert('输入的二级密码不能和密码一样');
      return false;
    }else{
		 $('#spwd').siblings("b").css('display','none');
	}
	
    if($('#spwd').val().length < 6){
		$('#spwd').siblings("b").css('display','block');
		$('#spwd').siblings("b").text('二级密码长度不得少于6位');
       // alert('二级密码长度不得少于6位');
        return false;
	}else{
		 $('#spwd').siblings("b").css('display','none');
	}
    if($('#spwd').val().length > 20){
		$('#spwd').siblings("b").css('display','block');
		$('#spwd').siblings("b").text('二级密码长度不得大于20位');
       // alert('二级密码长度不得大于20位');
        return false;
	}else{
		 $('#spwd').siblings("b").css('display','none');
	}

    //校验
    if($('#spwd').val() != $('#again_spwd').val()){
		$('#again_spwd').siblings("b").css('display','block');
		$('#again_spwd').siblings("b").text('两次输入的二级密码不一样');
     // alert('两次输入的二级密码不一样');
      return false;
    }else{
		 $('#again_spwd').siblings("b").css('display','none');
	}
	
	
	

    //姓名
    if($('#user_name').val() == ''){
		$('#user_name').siblings("b").css('display','block');
		$('#user_name').siblings("b").text('请输入姓名');
     // alert('请输入姓名');
      return false;
    }else{
		 $('#user_name').siblings("b").css('display','none');
	}
    if($('#user_name').val().length > 8){
		$('#user_name').siblings("b").css('display','block');
		$('#user_name').siblings("b").text('姓名字数不得大于4位');
       // alert('姓名字数不得大于4位');
        return false;
	}else{
		 $('#user_name').siblings("b").css('display','none');
	}
	if(!namer.test($('#user_name').val())){
		$('#user_name').siblings("b").css('display','block');
		$('#user_name').siblings("b").text('请输入中文姓名');
     // alert('请输入中文姓名');
      return false;
    }else{
		 $('#user_name').siblings("b").css('display','none');
	}

    //手机号
    //var reg = /^\d{11}$/;
    if(!phon.test($('#mobile').val())){
		$('#mobile').siblings("b").css('display','block');
		$('#mobile').siblings("b").text('请输入正确的手机号');
     // alert('请输入正确的手机号');
      return false;
    }else{
		 $('#mobile').siblings("b").css('display','none');
	}
	
	if($('#check_code').val() == ''){
		$('#check_code~b').text('请输入验证码');
		return false;
	}else{
		$('#check_code~b').text('');
	}
	
	if($('#check_code').val().length<6){
		$('#check_code~b').text('验证码必须为6位');
		return false;
	}else{
		$('#check_code~b').text('');
	}

    //短信校验
//     if($('#check_code').val()=='' || $('#check_code').val() != $('#sms_code').val()){
//       alert('请输入正确的短信验证码');
//       return false;
//     }

    //支付宝
    if($('#zfb_account').val() == ''){
		$('#zfb_account').siblings("b").css('display','block');
		$('#zfb_account').siblings("b").text('请输入支付宝账号');
     // alert('请输入支付宝账号');
      return false;
    }else{
		 $('#zfb_account').siblings("b").css('display','none');
	}

    $('#myform').submit();
  });
  var InterValObj;//time
  var count = 60;
  var curCount;
  //通过短信接口向手机发送短信
//通过短信接口向手机发送短信
  $('#btn_sendcode').on('click',  function(event) {
    var reg = /^\d{11}$/;
    if(!reg.test($('#mobile').val())){
		 $('#mobile').siblings("b").css('display','block');
		 $('#mobile').siblings("b").text('请输入正确的手机号');
     // alert('请输入正确的手机号');
      return false;
    }
    var mobile = $('#mobile').val();
    var checkmobile = mobile.substring(0,2);

	if (checkmobile == '17') {
	 $('#mobile').siblings("b").css('display','block');
		 $('#mobile').siblings("b").text('您的电话号码不符合');
		//alert("您的电话号码不符合");
		return false;
	}
    
    curCount = count;
	$('#btn_sendcode').attr('disabled','true');
	$('#btn_sendcode').val(curCount+'秒后输入');
	InterValObj = setInterval(SetRemainTime,1000);
	
    var url = '<?php echo site_url("reg/ajax_send_check_code") ?>';
    $.post(url, {mobile: $('#mobile').val()}, function(d) {
      console.log(d);
      if(d.err > 0){
       // alert('提交成功');
		$('.phoooo').css('display','block');
		$('.phoooo').text('发送成功,请查看您的手机');
        //$('#sms_code').val(d.code);
		
		//console.log(curCount);
      }else{
        alert(d.msg);
      }
    });
    //dosomething
    //var code = 123456;

    //$('#sms_code').val(code);

  });
  function SetRemainTime(){
		if(curCount == 0){
			clearInterval(InterValObj);
			$('#btn_sendcode').removeAttr('disabled');
			$('#btn_sendcode').val('发送验证码')
		}else{
			curCount--;
			//console.log(curCount)
			$('#btn_sendcode').val(curCount+'秒内输入');
		}
	}
})
	
</script>